import { LayerUI } from "./LayerUI";
import { UIConfig } from "./UIManager";


export interface PopViewParams {
    touchClose?: boolean,

    opacity?: number;
}

export class LayerPopUp extends LayerUI {

    protected black: cc.BlockInputEvents;

    constructor(name: string) {
        super(name);
        this.init();
    }

    private init() {
        this.black = this.addComponent(cc.BlockInputEvents);
        this.black.enabled = false;
    }

    add(config: UIConfig): string {
        this.black.enabled = true;
        return super.add(config);
    }

    remove(prefabPath: string): void {
        super.remove(prefabPath);
        this.setBlackDisable();
    }

    // protected removeByUuid(prefabPath: string, isDestroy: boolean): void {
    //     super.removeByUuid(prefabPath, isDestroy);
    //     this.setBlackDisable();
    // }

    protected setBlackDisable() {
        this.black.enabled = false;
    }

    clear() {
        super.clear()
        this.black.enabled = false;
        this.active = false;
    }
}